package com.wind.controller;

import Jama.Matrix;
import com.wind.config.PropConfig;
import com.wind.entity.FileContent;
import com.wind.entity.FileList;
import com.wind.entity.ReqDataBean;
import com.wind.model.*;
import com.wind.service.KylinService;
import com.wind.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;
import java.util.*;

/**
 * @Author: wind
 * @Description:
 * @Date: 2018/8/9 上午9:45
 */
@Controller
public class KylinController {

    private Logger logger = LoggerFactory.getLogger(KylinController.class);

    @Autowired
    KylinService kylinService;

    @Autowired
    PropConfig propConfig;

    @RequestMapping("/")
    String index() {
        return "index";
    }

    @RequestMapping("/demo")
    String demo() {
        return "demo";
    }

    @RequestMapping("/leoresult")
    String leoresult(LeoResult leoResult) {
       int i=0;
        i=i+2;

        String  d = leoResult.getSavetime();


        kylinService.insertLeoResult(leoResult);

        return "leoresult";
    }

    public void runORB_EPH() {
        Runtime rn = Runtime.getRuntime();
        try {
            rn.exec(propConfig.getORB_EPHlocation() +"/orb_eph.exe",null,new File(propConfig.getORB_EPHlocation()));
        } catch (Exception e) {
            logger.error("exec error",e);
        }

    }

    @RequestMapping("/GEO_computation")
    @ResponseBody
    public Object GEO_computation(String filetype) {
        List<FileContent> Obv ;//= importdata('QS-5A.txt');
        List<FileContent> Target ;//= importdata('Target.txt');
        List<FileContent>  EulerAngles;
        List< double [][]> Obv_R =  new ArrayList<>();
        List< double [][]> Obv_V =  new ArrayList<>();
        List< double [][]> Target_R =  new ArrayList<>();
        List< double [][]> Target_V =  new ArrayList<>();
        List< double [][]> Angle =  new ArrayList<>();
        List<Double> PhiList =  new ArrayList<>();
        List< Double >ThetaList=  new ArrayList<>();
        List< Double> PsiList=  new ArrayList<>();
        List<Integer> Access =new ArrayList<>();
        List<Integer> testret =new ArrayList<>();
        if(StringUtil.getStr(filetype).equals("1")) {
            Obv = Tools.getFileContent(propConfig.getLocation() + "/" + "QS-5A.txt");
            Target = Tools.getFileContent(propConfig.getLocation() + "/" + "Target.txt");
            EulerAngles = Tools.getFileContent(propConfig.getLocation() + "/" + "EulerAngles.txt");


            for (int i = 0; i < Obv.size(); i++) {
                String[] data = Obv.get(i).getContent().toString().split("X");
                double [][] doubler =   {
                        {new Double(data[0]),new Double(data[ 1]) , new Double(data[2])}};
                double [][] doublev= {
                        {new Double(data[3]) , new Double(data[4]) , new Double(data[5])}};

                Obv_R.add(doubler);
                Obv_V.add(doublev);
            }
            for (int i = 0; i < EulerAngles.size(); i++) {
                String[] data = EulerAngles.get(i).getContent().toString().split("X");


                PhiList.add(new Double(data[0]));
                ThetaList.add(new Double(data[1]));
                PsiList.add(new Double(data[2]));
            }
            for (int i = 0; i < Target.size(); i++) {
//                if(i==23977)
//                {
//                    int ccc=i;
//                    ccc=9;
//                }
                String[] data = Target.get(i).getContent().toString().split("X");
                double [][] doubler =   {
                        {new Double(data[1]) , new Double(data[2]) , new Double(data[3])}};
                double [][] doublev= {
                        {new Double(data[4]) , new Double(data[5]) , new Double(data[5])}};
//                System.out.println(i);
                Target_R.add(doubler);
                Target_V.add(doublev);

            }

        }

        for(int ii=0;ii<Obv_R.size();ii++) {
            double[][] xx = Obv_R.get(ii);
            double[][] xxv = Obv_V.get(ii);
            Matrix Ri = new Matrix(xx);
            Matrix Vi = new Matrix(xxv);
            Matrix Ai2i = new Matrix(JamaTest.MatrixJ2000ToInertial(Ri, Vi));
            double Phi = PhiList.get(ii);
            double Theta = ThetaList.get(ii);
            double Psi = PsiList.get(ii);
            double [][]  dRx ={
                    {1,0,0 },
                    { 0 , Math.cos(Math.toRadians (Phi)),  Math.sin(Math.toRadians (Phi)) },
                    {0 , -Math.sin(Math.toRadians (Phi)) , Math.cos(Math.toRadians (Phi))}
            };

            double [][]  dRy = {
                    { Math.cos(Math.toRadians (Theta)), 0, -Math.sin(Math.toRadians (Theta))},
                    {0, 1, 0},
                    { Math.sin(Math.toRadians (Theta)), 0,  Math.cos(Math.toRadians (Theta))}
            };
            double [][]  dRz ={
                    { Math.cos(Math.toRadians (Psi)) ,  Math.sin(Math.toRadians (Psi)) , 0},
                    {  -Math.sin(Math.toRadians (Psi)) ,  Math.cos(Math.toRadians (Psi)) ,0},
                    {0,0,1}
            };
            Matrix Rx = new Matrix(dRx);
            Matrix Ry = new Matrix(dRy);
            Matrix Rz = new Matrix(dRz);
            Matrix txy=  Rx.times(Ry.transpose()) ;
            Matrix txyz1=  txy.times(Rz) ;
            Matrix T =  txyz1.times(Ai2i) ;
            Matrix Target_Rtemp =new Matrix( Target_R.get(ii));
            Matrix Obv_Rtemp =new Matrix( Obv_R.get(ii));
            Matrix Totemp = Target_Rtemp.transpose().minus(Obv_Rtemp.transpose());
            Matrix R = T.times(Totemp).transpose();
            double tempxx =R.get(0,0)/Math.pow((Math.pow( R.get(0,0),2)+Math.pow(R.get(0,1),2 )),0.5);
            double tempxxx = R.get(0,1)/Math.pow(( Math.pow(R.get(0,0),2)+Math.pow(R.get(0,1),2) ),0.5 );

            double[][] rx ={{R.get(0,0)/Math.pow((Math.pow( R.get(0,0),2)+Math.pow(R.get(0,1),2 )),0.5) ,
                    R.get(0,1)/Math.pow(( Math.pow(R.get(0,0),2)+Math.pow(R.get(0,1),2) ),0.5 )
                    , 0}};

            double[][] ry = {{ 0 ,
            R.get(0,1)/Math.pow(( Math.pow(R.get(0,1),2)+Math.pow(R.get(0,2),2) ),0.5) ,
                    R.get(0,2)/Math.pow(( Math.pow(R.get(0,1),2)+Math.pow(R.get(0,2),2) ),0.5)}};
            double[][] tempss ={{0,1,0}};

            double dottemprx =JamaTest.MatrixADotProductMatrixB(new Matrix(rx),new Matrix(tempss));

            double dottempry =JamaTest.MatrixADotProductMatrixB(new Matrix(ry),new Matrix(tempss));

            double theta_x = Math.toDegrees(Math.acos(dottemprx));

            double theta_y  = Math.toDegrees(Math.acos(dottempry));

            if ((theta_x<1)&&(theta_y<1))
            {            //   % 判断目标在视场内
                Access.add(new Integer(1));
                testret.add(ii);
            }
            else
            {
                Access.add(new Integer(0));
            }
    //            ry = [ 0 ; R(2,1)/( R(2,1)^2+R(3,1)^2 )^0.5 ; R(3,1)/( R(2,1)^2+R(3,1)^2 )^0.5 ] ;  %在YOZ面的投影
    //
    //                    theta_x = acosd( dot(rx,[0;1;0]) ) ;    %方位角
    //                    theta_y = acosd( dot(ry,[0;1;0]) ) ;    %俯仰角




            int ksdfd=0;
            ksdfd=123;
        }

        return  Access;
    }

    @RequestMapping("/jiaohui_computation")
    @ResponseBody
    public Object jiaohui_computation(String filetype) {

        List<FileContent> Obv ;//= importdata('QS-5A.txt');
        List<FileContent> Target ;//= importdata('Target.txt');
        List< double [][]> Obv_R =  new ArrayList<>();
        List< double [][]> Obv_V =  new ArrayList<>();
        List< double [][]> Target_R =  new ArrayList<>();
        List< double [][]> Target_V =  new ArrayList<>();
        List< double [][]> Angle =  new ArrayList<>();

        //卫星在J2000.0惯性坐标系中空间位置转卫星坐标系
//        Obv_R = Obv(:,2:4) ;
//        Obv_V = Obv(:,5:7) ;
//        Target_R = Target(:,2:4) ;
//        Target_V = Target(:,5:7)

        if(StringUtil.getStr(filetype).equals("1")) {
            Obv = Tools.getFileContent(propConfig.getLocation() + "/" + "QS-5A.txt");
            Target = Tools.getFileContent(propConfig.getLocation() + "/" + "Target.txt");

            for (int i = 0; i < Obv.size(); i++) {
                String[] data = Obv.get(i).getContent().toString().split("X");
                double [][] doubler =   {
                        {new Double(data[2]),new Double(data[3]) , new Double(data[4])}};
                double [][] doublev= {
                        {new Double(data[5]) , new Double(data[6]) , new Double(data[7])}};

                Obv_R.add(doubler);
                Obv_V.add(doublev);
            }

            for (int i = 0; i < Target.size(); i++) {
                String[] data = Target.get(i).getContent().toString().split("X");
                double [][] doubler =   {
                        {new Double(data[2]) , new Double(data[3]) , new Double(data[4])}};
                double [][] doublev= {
                        {new Double(data[5]) , new Double(data[6]) , new Double(data[7])}};

                Target_R.add(doubler);
                Target_V.add(doublev);


            }

        }
        for(int ii=0;ii<Obv_R.size();ii++)
        {
            double [][] xx =Obv_R.get(ii);
            double [][] xxv =Obv_V.get(ii);
            Matrix Ri = new Matrix(xx);
            Matrix Vi = new Matrix(xxv);
            Matrix Ai2i = new Matrix(JamaTest.MatrixJ2000ToInertial(Ri,Vi));

            double [][] xxvtemp =Target_R.get(ii);
            Matrix ret =   new Matrix(xxvtemp).minus(new Matrix(xx));
//            Matrix rc =ret.times(Ai2i);
            // r = Ai2i*( Target_R(i,:)' - Obv_R(i,:)' ) ;这句话相当于下面先 倒置 再相乘
            Matrix r =ret.times(Ai2i.transpose());

            double[][] drx = {{ r.get(0,0)/ Math.pow(( Math.pow(r.get(0,0),2)+Math.pow(r.get(0,1),2)),0.5)  ,
                    r.get(0,1)/ Math.pow(( Math.pow(r.get(0,0),2)+ Math.pow(r.get(0,1),2) ),0.5) , 0 }};
            double[][] dry = {{ 0 , r.get(0,1)/Math.pow(( Math.pow(r.get(0,1),2)+Math.pow(r.get(0,2),2) ),0.5) ,
                    r.get(0,2)/Math.pow(( Math.pow(r.get(0,1),2)+Math.pow(r.get(0,2),2) ),0.5)  }};
//            double[][] dry = [ 0 ; r(2,1)/( r(2,1)^2+r(3,1)^2 )^0.5 ; r(3,1)/( r(2,1)^2+r(3,1)^2 )^0.5 ] ;
            double[][] dottempxx={{0,1,0}};
            double dottemp =JamaTest.MatrixADotProductMatrixB(new Matrix(dry),new Matrix(dottempxx));
            double Phi = Math.toDegrees(Math.acos(dottemp));

            double Theta= 0 ;
            double dottempPsi =JamaTest.MatrixADotProductMatrixB(new Matrix(drx),new Matrix(dottempxx));
            double Psi=Math.toDegrees(Math.acos(dottempPsi));

            double [][]  dRx ={
                    {1,0,0 },
                    { 0 , Math.cos(Math.toRadians (Phi)),  Math.sin(Math.toRadians (Phi)) },
                    {0 , -Math.sin(Math.toRadians (Phi)) , Math.cos(Math.toRadians (Phi))}
            };

            double [][]  dRy = {
                    { Math.cos(Math.toRadians (Theta)), 0, -Math.sin(Math.toRadians (Theta))},
                    {0, 1, 0},
                    { Math.sin(Math.toRadians (Theta)), 0,  Math.cos(Math.toRadians (Theta))}
            };
            double [][]  dRz ={
                    { Math.cos(Math.toRadians (Psi)) ,  Math.sin(Math.toRadians (Psi)) , 0},
                    {  -Math.sin(Math.toRadians (Psi)) ,  Math.cos(Math.toRadians (Psi)) ,0},
                    {0,0,1}
            };
            Matrix Rx = new Matrix(dRx);
            Matrix Ry = new Matrix(dRy);
            Matrix Rz = new Matrix(dRz);
            Matrix txy=  Rx.times(Ry.transpose()) ;
//            Matrix txyz=  txy.times(Rz.transpose()) ;
            Matrix txyz1=  txy.times(Rz) ;
//            Matrix txyza=  txyz1.times(Ai2i.transpose()) ;
            Matrix T =  txyz1.times(Ai2i) ;
            double Angle1 =Math.asin(T.get(1,2));

            double y = -T.get(0,2);
            double x =  T.get(2,2);
            double Angle2 = Math.atan2(y,x);

            double y3 = -T.get(1,0);
            double x3 =  T.get(1,1);
            double Angle3 = Math.atan2(y3,x3);

            double[][] Angletemp ={
                    {ii ,  Angle3*180/Math.PI , Angle1*180/Math.PI  , Angle2*180/Math.PI }
            };

            Angle.add(Angletemp);
            int ksdfd=0;
            ksdfd=123;
//            Rx = [ 1,0,0 ; 0 , cosd(Phi) , sind(Phi) ; 0 , -sind(Phi) , cosd(Phi) ] ;
        }

        return  Tools.getSuccRespMap("jiaohui_computation成功！");
    }
    @RequestMapping("/testSAA")
    @ResponseBody
    public List<String> testSAA(String filetype) {

//        %%  saa 过境时间计算---通过射线法来判断
//                %%%%%function SaaTime = SaaAccess(SaaArea,SubPoint)
//                % SaaArea: SAA区范围---通过经纬度来定义
//                % SubPoint：卫星星下点经纬度---time、Longitude、Latitude
//                % SaaTime：卫星穿越SAA区时间段---ts，te
//
//                % --------------
//                % 确定SAA区的特征点（经纬度最大最小值）
//% --------------
        List saaList = propConfig.getSAA();

        List<FileContent> eph_blhlist = Tools.getFileContent(propConfig.getORB_EPHlocation()+"/"+"eph_blh.txt");
        List<String> SaaTimeAll =  new ArrayList<>();
        List<String> SatSubLon = new ArrayList<>();
        List<String> SatSubLat = new ArrayList<>();
        List<String> AllTime = new ArrayList<>();
        List<String> SaaLon = propConfig.getSaaLonList();
        List<String> SaaLat = propConfig.getSaaLatList();
        String MaxSaaLon  =propConfig.getMaxSaaLon();
        String MaxSaaLat  =propConfig.getMaxSaaLat();
        String MinSaaLon  =propConfig.getMinSaaLon();
        String MinSaaLat  =propConfig.getMinSaaLat();

//        % -------------
//                % 筛选穿越SAA区的所有时刻
//                % -------------
//                %%%%%AllTime = SubPoint(:,1);
//%%%%%SatSubLon = SubPoint(:,2);
//%%%%%SatSubLat = SubPoint(:,3);
        //26格式
        if(StringUtil.getStr(filetype).equals("1"))
        {
           eph_blhlist = Tools.getFileContent(propConfig.getORB_EPHlocation()+"/"+"eph_blhtest.txt");
            for (int i = 0; i < eph_blhlist.size(); i++) {
                String[] data = eph_blhlist.get(i).getContent().toString().split("\t");
                String time = data[0];//data[0] + data[1] + data[2] + data[3] + data[4] + StringUtil.getStrZero(data[5]) + StringUtil.getStrZero(data[6]) + data[7];
                String lon = data[1];//data[11];
                String lat = data[2];//data[13];
                AllTime.add(time);
                SatSubLon.add(lon);
                SatSubLat.add(lat);
            }
        }
        else {
            eph_blhlist = Tools.getFileContent(propConfig.getORB_EPHlocation()+"/"+"eph_blh.txt");
            for (int i = 0; i < eph_blhlist.size(); i++) {
                String[] data = eph_blhlist.get(i).getContent().toString().split("\\s+");
                String time = data[0] + data[1] + data[2] + data[3] + data[4] + StringUtil.getStrZero(data[5]);
                time = data[0]+"-"+data[1]+"-"+data[2]+" "+data[3]+":"+data[4]+":"+data[5];
                String lon = data[6];
                String lat = data[7];
                AllTime.add(time);
                SatSubLon.add(lon);
                SatSubLat.add(lat);
            }
        }
//         % *****第一步：通过特征点进行初选
        for(int ii=0;ii<AllTime.size();ii++)
        {
            Double x =  new Double(SatSubLon.get(ii));
            Double y =  new Double(SatSubLat.get(ii));
            if (new Double(x)>new Double(MaxSaaLon)||new Double(x)<new Double(MinSaaLon)||new Double(y)>new Double(MaxSaaLat)||new Double(y)<new Double(MinSaaLat))
            {
                continue;
            }

// % ******第二步：判断当前有可能的点是否在SAA区内
            String TempTime = AllTime.get(ii);
            if(TempTime.equals("2016/8/1 5:33:05"))
            {
                int aa=5;
            }
            int flag = 0;
            for (int jj = 0;jj<SaaLon.size()-1;jj++) {
                Double x1 = new Double(SaaLon.get(jj));
                Double y1 = new Double(SaaLat.get(jj));
                Double x2 =  new Double(SaaLon.get(jj + 1));
                Double y2 =  new Double(SaaLat.get(jj + 1));
                Double TempC = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
                if ((y2 - y)*(y1 - y) < 0 && x < TempC) {
                    flag = flag + 1;
                }
            }
            int cc =  flag% 2;
            if (cc==1) {
                SaaTimeAll.add(TempTime);  //% 如果射线切过的边数量为奇数，则过SAA区
            }
        }

        return SaaTimeAll;//Tools.getSuccRespMap("testSAA成功！");
    }
    @RequestMapping("/ORB_EPH")
    @ResponseBody
    public Object ORB_EPH() {
        TaskAnalysisQuence taskAnalysisQuence= kylinService.selectTaskAnalysisQuenceByCreatTime();
        ReqDataBean reqDataBean = ReqDataBean.getInstance();
        reqDataBean.setTaskAnalysisQuence(taskAnalysisQuence);


//    开工文件 ORB_EPH_START.IFM
//        内容为预报开始时间和预报结束时间、时间间隔、轨道根数有效期。
//        第1行  预报开始的年、月、日、时、分、秒（北京时，以空格区分）
//        第2行  预报结束的年、月、日、时、分、秒（北京时，以空格区分）
//        第3行  输出时间间隔  （单位：秒）
// 从tash_user 找到开始时间和结束时间        00233a9fdba443258b9a12081daade44


        TaskUser taskUser = new  TaskUser();
        taskUser =kylinService.selectTaskUserByPrimaryKey(reqDataBean.getTaskAnalysisQuence().getTaskGuid());

        ReqDataBean.setTaskBeginTime(DateUtil.dateToString(taskUser.getStartTime(),DateUtil.normalTimeFormat));

        String firstrow;
        String secondrow;
        String thirdrow;
        firstrow = DateUtil.formatDate(taskUser.getStartTime(),DateUtil.twoSixFormat);
        secondrow = DateUtil.formatDate(taskUser.getEndTime(),DateUtil.twoSixFormat);
        thirdrow = propConfig.getOrbitTimeInterval();

        FileOutputStream out = null;

        File  tempFile1=  new File(propConfig.getORB_EPHlocation()+"/orb_eph_start.ifm");
        if(tempFile1.exists()) {
            tempFile1.delete();
        }

        try {
            out = new FileOutputStream(tempFile1);
            out.write((firstrow+"\r\n").getBytes());
            out.write((secondrow+"\r\n").getBytes());
            out.write((thirdrow+"\r\n").getBytes());
            out.close();
        } catch ( Exception e) {
            e.printStackTrace();
        }
//        2)J2000惯性系开普勒根数文件ORB_EPH_ORBIT.IFM
//        共一行，行内数据以空格区分，顺序为：
//        年 月 日 时 分 秒  a  e   i   Ω  ω  M  （单位: m, deg）（北京时

        SateOrbitWithBLOBs sateOrbitWithBLOBs =kylinService.selectLastOne(new String(""));


        reqDataBean.setSateOrbitWithBLOBs(sateOrbitWithBLOBs);
        reqDataBean.setTaskUser(taskUser);
        
        String firstrow2="";


        firstrow2 = DateUtil.formatDate(sateOrbitWithBLOBs.getEpochTime(),DateUtil.twoSixFormat);

        firstrow2 =firstrow2+" "+ sateOrbitWithBLOBs.getA()+" "+ sateOrbitWithBLOBs.getE()+" "+ sateOrbitWithBLOBs.getI()
        +" "+ sateOrbitWithBLOBs.getO()+" "+ sateOrbitWithBLOBs.getW()+" "+ sateOrbitWithBLOBs.getM();

        FileOutputStream out2 = null;

        File  tempFile=  new File(propConfig.getORB_EPHlocation()+"/orb_eph_orbit.ifm");
        if(tempFile.exists()) {
            tempFile.delete();
        }

        try {
            out2 = new FileOutputStream(tempFile);
            out2.write((firstrow2+"\r\n").getBytes());
            out2.close();
        } catch ( Exception e) {
            e.printStackTrace();
        }

        Runtime rn = Runtime.getRuntime();
        try {
            rn.exec(propConfig.getORB_EPHlocation() +"/orb_eph.exe",null,new File(propConfig.getORB_EPHlocation()));
        } catch (Exception e) {
            logger.error("exec error",e);
        }
        return Tools.getSuccRespMap("orb_eph成功！");
    }




    @RequestMapping("/toFileDetail")
    String toFileDetail(String fileName, Model model) {
        model.addAttribute("fileName",fileName);
        return "fileDetail";
    }

    @RequestMapping("/getFileDetail")
    @ResponseBody
    public Object getFileDetail(String fileName) throws IOException {
        return Tools.getSuccRespMap("数据获取成功！",Tools.getFileContent(propConfig.getLocation()+"/"+fileName));
    }

    @RequestMapping("/getFileDetailPage")
    @ResponseBody
    public Object getFileDetailPage(String fileName,Integer page,Integer limit){
        return kylinService.getFileDetailPage(fileName,page,limit);
    }

    @RequestMapping("/tleEph")
    @ResponseBody
    public Map<String,Object> tleEph() {
        Runtime rn = Runtime.getRuntime();
        try {
            rn.exec(propConfig.getLocation() +"/TLE_EPH.exe",null,new File(propConfig.getLocation()));
        } catch (Exception e) {
            logger.error("exec error",e);
        }
        return Tools.getSuccRespMap("");
    }

    @RequestMapping("/dealFile")
    @ResponseBody
    public Object dealFile() {
        List<FileList> list = Tools.getFileList(propConfig.getLocation());
        List<FileDetail> fdList = new ArrayList<>();
        if(list.size()>0){
            kylinService.deleteAllFileDetail();
        }
        for(FileList fl:list){
            List<FileContent> fcList = Tools.getFileContent(propConfig.getLocation()+"/"+fl.getFileName());
            int iCount = 0;
            for(FileContent fc:fcList){
                iCount++;
                fdList.add(new FileDetail(fl.getFileName(),fc.getContent()));
                if(iCount==100){
                    kylinService.insertBatchFileDetail(fdList);
                    fdList.clear();
                    iCount = 0;
                }
            }
            if(fdList.size()>0){
                kylinService.insertBatchFileDetail(fdList);
            }
        }
        return Tools.getSuccRespMap();
    }

    /**
     * 实现文件上传
     * */
    @RequestMapping("/fileUpload")
    @ResponseBody
    public Map<String,Object> fileUpload(MultipartFile file) throws IOException {
        String filePath = propConfig.getLocation() + UploadUtil.uploadFile(file, propConfig.getLocation());
        Map<String,Object> map = Tools.getSuccRespMap("文件上传成功！");
        map.put("filePath",filePath);
        return map;
    }

    @RequestMapping("/getFileList")
    @ResponseBody
    public Object getFileList() throws IOException {
        return Tools.getSuccRespMap("数据获取成功！", Tools.getFileList(propConfig.getLocation()));
    }

    @RequestMapping("/getFileDetailById")
    @ResponseBody
    Object getFileDetailById(Integer id) {
        return kylinService.selectByPrimaryKey(id);
    }




}